package com.founder.gateway.component.transport.netty.http;

import com.founder.gateway.system.bean.SetuResult;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.DecoderResult;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpVersion;

public class NettyHttpResponse implements HttpResponse{
	FullHttpResponse httpResponse;
	private byte[] content;
	private SetuResult setuResult;
	public NettyHttpResponse(FullHttpResponse fullHttpResponse) {
		this.httpResponse=fullHttpResponse;
	}
	
	public FullHttpResponse getHttpResponse() {
		return httpResponse;
	}

	public void setHttpResponse(DefaultFullHttpResponse httpResponse) {
		this.httpResponse = httpResponse;
	}

	@Override
	@Deprecated
	public HttpVersion getProtocolVersion() {
		return httpResponse.getProtocolVersion();
	}

	@Override
	public HttpVersion protocolVersion() {
		return httpResponse.protocolVersion();
	}

	@Override
	public HttpHeaders headers() {
		return httpResponse.headers();
	}

	@Override
	@Deprecated
	public DecoderResult getDecoderResult() {
		return httpResponse.getDecoderResult();
	}

	@Override
	public DecoderResult decoderResult() {
		return httpResponse.decoderResult();
	}

	@Override
	public void setDecoderResult(DecoderResult result) {
		httpResponse.setDecoderResult(result);		
	}

	@Override
	@Deprecated
	public HttpResponseStatus getStatus() {
		return httpResponse.getStatus();
	}

	@Override
	public HttpResponseStatus status() {
		return httpResponse.status();
	}

	@Override
	public HttpResponse setStatus(HttpResponseStatus status) {
		return httpResponse.setStatus(status);
	}

	@Override
	public HttpResponse setProtocolVersion(HttpVersion version) {
		return httpResponse.setProtocolVersion(version);
	}
	
	public ByteBuf content() {
		return httpResponse.content();
	}

	public byte[] getContent() {
		return content;
	}

	public void setContent(byte[] content) {
		this.content = content;
	}

	public SetuResult getSetuResult() {
		return setuResult;
	}

	public void setSetuResult(SetuResult setuResult) {
		this.setuResult = setuResult;
	}
}
